﻿@using BlogEngine.NET.Custom.Widgets
@using BlogEngine.Core
@{
    var showrssicon = true;
    var showpostcount = true;

    var widgetId = Request.QueryString["id"];
    var settings = Common.GetSettings(widgetId);

    if (IsPost)
    {
        if (Validation.IsValid())
        {
            settings["showrssicon"] = Request.Form["cbShowRssIcon"] == "on" ? "true" : "false";
            settings["showpostcount"] = Request.Form["cbShowPostCount"] == "on" ? "true" : "false";
            Common.SaveSettings(settings, widgetId);
            @:
            <script type="text/javascript">window.parent.toastr.success("Completed");</script>
        }
    }
    if (settings != null && settings.Count > 0)
    {
        showrssicon = settings["showrssicon"] == "true" ? true : false;
        showpostcount = settings["showpostcount"] == "true" ? true : false;
    }
}
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" href="~/Content/bootstrap.min.css">
    <link rel="stylesheet" href="~/admin/themes/standard/css/styles.css">
</head>
<body class="widget-edit">
    <form method="post">
        <div class="form-group">
            <label>
                @Html.CheckBox("cbShowRssIcon", showrssicon) Show the RSS icon
            </label>
        </div>
        <div class="form-group">
            <label>
                @Html.CheckBox("cbShowPostCount", showpostcount) Show number of posts in category
            </label>
        </div>
        <div>
            <button type="submit" class="btn btn-success">
                @Resources.labels.save
            </button>
        </div>
    </form>
</body>
</html>